home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWShpLst.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.3 KB  |  166 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWShpLst.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSHPLST_H
  11. #define FWSHPLST_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWENVDEF_H
  20. #include "FWEnvDef.h"
  21. #endif
  22.  
  23. #ifndef FWEXCLIB_H
  24. #include "FWExcLib.h"
  25. #endif
  26.  
  27. #ifndef FWCOUPTR_H
  28. #include "FWCouPtr.h"
  29. #endif
  30.  
  31. #ifndef FWTCOLL_H
  32. #include "FWTColl.h"
  33. #endif
  34.  
  35. // ----- OpenDoc Includes -----
  36.  
  37. #ifndef FWODTYPS_H
  38. #include "FWODTyps.h"
  39. #endif
  40.  
  41. //========================================================================================
  42. //    Forward Declarations
  43. //========================================================================================
  44.  
  45. class FW_CGraphicContext;
  46. class FW_CPoint;
  47. class FW_CRect;
  48. class FW_CReadableStream;
  49. class FW_CWritableStream;
  50.  
  51. //========================================================================================
  52. //    class FW_CShapeListRep
  53. //========================================================================================
  54.  
  55. class FW_CShapeListRep : public FW_MCountedPtrRep
  56. {
  57.  
  58.     friend class FW_CShapeListIterator;
  59.  
  60. //----------------------------------------------------------------------------------------
  61. //    Constructors/Destructors
  62. //
  63. public:
  64.  
  65.     FW_DECLARE_AUTO(FW_CShapeListRep)
  66.  
  67.     FW_CShapeListRep();
  68.     FW_CShapeListRep(const FW_CShapeListRep& other);
  69.     FW_CShapeListRep(FW_CReadableStream& stream);
  70.     ~FW_CShapeListRep();
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    New API
  74. //
  75.  
  76. public:
  77.     void            Write(FW_CWritableStream& stream) const;
  78.     FW_Boolean        IsEqual(const FW_CShapeListRep* other) const;
  79.  
  80.     // ----- Adding shapes
  81.     
  82.     void            AdoptAtTop(FW_CShape* shape);
  83.     void            AdoptAtBottom(FW_CShape* shape);
  84.     void            AdoptBelow(FW_CShape* shapeToAdd, FW_CShape* belowWhich);
  85.     void            AdoptAbove(FW_CShape* shapeToAdd, FW_CShape* aboveWhich);
  86.  
  87.     // ----- Removing shapes
  88.  
  89.     void            Remove(FW_CShape* shape);
  90.     void            RemoveAll();
  91.     void            DeleteAll();
  92.     FW_CShape*        RemoveTop();
  93.     FW_CShape*        RemoveBottom();
  94.  
  95.     // ----- List operations
  96.  
  97.     FW_Boolean        Contains(FW_CShape* shape) const;
  98.     unsigned long    GetCount() const;
  99.     void            Purge();
  100.     
  101.     // ----- Z-Order methods
  102.  
  103.     FW_Boolean        MoveUp(FW_CShape* shape);
  104.     FW_Boolean        MoveToTop(FW_CShape* shape);
  105.         
  106.     FW_Boolean        MoveDown(FW_CShape* shape);
  107.     FW_Boolean        MoveToBottom(FW_CShape* shape);
  108.  
  109.     // ----- Anchor Point 
  110.     FW_CPoint        GetAnchorPoint() const;
  111.  
  112. //----------------------------------------------------------------------------------------
  113. //    Internal API
  114. //
  115. private:
  116.     void            PrivFree();
  117.     
  118. //----------------------------------------------------------------------------------------
  119. //    Data Members
  120. //
  121. private:
  122.     FW_TOrderedCollection<FW_CShape>*    fShapeList;
  123.     FW_Boolean                            fValidAnchorPoint;
  124.     FW_CPoint                            fAnchorPoint;
  125. };
  126.  
  127. //========================================================================================
  128. //    class FW_PShapeList
  129. //========================================================================================
  130.  
  131. class FW_PShapeList : public FW_TCountedPtr<FW_CShapeListRep>
  132. {
  133. public:
  134.     FW_PShapeList();
  135.     FW_PShapeList(FW_CReadableStream& stream);
  136.     virtual ~FW_PShapeList();
  137.     
  138.     FW_PShapeList(const FW_PShapeList& other);
  139.     FW_PShapeList& operator=(const FW_PShapeList& other);
  140.     
  141.     FW_PShapeList    Copy() const;
  142.  
  143.     friend FW_CWritableStream& operator << (FW_CWritableStream& stream, const FW_PShapeList& list);
  144.     friend FW_CReadableStream& operator >> (FW_CReadableStream& stream, FW_PShapeList& list);
  145. };
  146.  
  147. //========================================================================================
  148. //    class FW_CShapeListIterator
  149. //========================================================================================
  150.  
  151. class FW_CShapeListIterator : public FW_TOrderedCollectionIterator<FW_CShape>
  152. {
  153. public:
  154.     FW_DECLARE_AUTO(FW_CShapeListIterator)
  155.  
  156.     FW_CShapeListIterator(const FW_PShapeList& shapeList) :
  157.         FW_TOrderedCollectionIterator<FW_CShape>(shapeList->fShapeList) {}
  158.     FW_CShapeListIterator(const FW_CShapeListRep& shapeListRep) :
  159.         FW_TOrderedCollectionIterator<FW_CShape>(shapeListRep.fShapeList) {}
  160.     ~FW_CShapeListIterator() {}
  161. };
  162.  
  163.  
  164.  
  165. #endif
  166.